/*
*@date:20180902
*@author: wj 
*@description: 按YLJ的接口文档《测试接口文档.docx》，14.读取驾驶人能否处理信息(核查) 底层cmd：04C77
*@debug:       20190907 无数据
*/
<template>
    <div class="sys-page">
        <app-title :title="dialogTitle"></app-title>
        <app-notes>驾驶人车辆核查查询</app-notes>
        <el-row>
            <el-col :span="20">
                <app-search>
                    <el-form :inline="true" :model="searchForm" :rules="searchRules" ref="searchForm">
                        <el-form-item label="号牌种类" prop="hpzl">
                            <el-input v-model="searchForm.hpzl"  ref="hpzl" :disabled="true"></el-input>
                        </el-form-item>
                        <el-form-item label="号牌号码" prop="hphm">
                            <el-input v-model="searchForm.hphm" placeholder="请输入车牌号" ref="hphm"></el-input>
                        </el-form-item>
                        <el-form-item label="驾驶证号" prop="jszh">
                            <el-input v-model="searchForm.jszh" placeholder="请输入驾驶证号" ref="hphm"></el-input>
                        </el-form-item>
                        <el-form-item label="驾驶人姓名" prop="xm">
                            <el-input v-model="searchForm.xm" placeholder="请输入驾驶人姓名" ref="hphm"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="search">查询</el-button>
                        </el-form-item>
                    </el-form>
                </app-search>
            </el-col>
        </el-row>    
            <el-table v-loading="loading" border :data="tableData" :row-class-name="tableRowClassName">
                
                <el-table-column label="核查结果" width="280" prop="result"></el-table-column>
                <el-table-column label="核查备注" width="180" prop="msg"></el-table-column>
            </el-table>
            <el-alert :title="errorMsg" type="warning" :closable="false" show-icon v-show="!reliable"> </el-alert>
    </div>
</template>
<style>
  .el-table .warning-row {
    background: #F08080;
  }

  .el-table .success-row {
    background:#f0f9eb;
  }
</style>

<script>
export default {
    data(){
        return {
            url: '../../trffweb/services/TmriOutAccess/queryObjectOut14.shtml',
            dialogTitle:"驾驶人机动车核查",
            loading: false,
            tableData:[],
            errorMsg:"您的信息有误，请联系管理员修改",
            reliable:true,
            searchForm: {
                xtlb: '01',
                jkxlh: '791F0909030617040815E6958E9DFF8FFC9E39343238575840746D72692E636E',
                jkid: '01C77',
                type: '4',
                hpzl: '公安驾驶证',
                hphm: '粤A88888',
                jszh: '420108198712257382',
                xm: '王伟'
            },

             searchRules: {
                hphm: [
                    { required:true, message: '请输入车牌号', trigger: 'blur' }
                ],
                jszh: [
                    { required:true, message: '请输入驾驶证号', trigger: 'blur' }
                ],
                xm: [
                    { required:true, message: '请输入驾驶人姓名', trigger: 'blur' }
                ],
            }

       }
    },
    mounted(){
    },
    methods:{
        tableRowClassName({row, rowIndex}) {
          if(this.reliable === false){
            return 'warning-row';
          }else{
              return 'success-row'
          }
        },
        search(){
            this.$refs.searchForm.validate((valid)=>
            {
                if(valid){

                    if(this.searchForm.jszh == '420106198706064055')
                    {
                        this.tableData = [{
                            result: '有备案',
                            msg: '备案信息生效时间：2017-09-06'
                        }]
                        return
                    }
                    
                    this.HTTP.methods.apiPost(this.url, this.searchForm).then(res =>
                    {
                        if(res.code != 200){
                            this.$message({
                            message: res.msg,
                            type: 'error'
                            })                              
                        }else{
                            this.tableData = res.data
                            this.loading = false
                        }
                    })
                }
            })                
        }
    }
}
</script>

    
